﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using B2BCore;

namespace B2BClient
{
    public partial class Login : Form
    {
        /// <summary>
        /// Function to initialise login form
        /// </summary>
        public Login()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {

        }

        private void Login_Load(object sender, EventArgs e)
        {
            //log that the client login form has been opened
            LogHelper.Log("Login Form", System.Diagnostics.TraceEventType.Start);

            //load form strings
            lblServerList.Text = Strings.LoginForm.LoginFormServer;
            lblName.Text = Strings.LoginForm.LoginFormName;
            this.Text = Strings.LoginForm.LoginFormTitle;
            chkSound.Text = Strings.LoginForm.LoginFormSound;
            btnLogin.Text = Strings.LoginForm.LoginFormLogin;

            //load status bar strings
            pgrLoginProgress.Value = 0;
            staLoginStatus.Text = Strings.LoginStatus.LoginStatusDefault;

            //log that default values and strings loaded if in debug
            LogHelper.Log("Login Form Strings and Values Loaded",System.Diagnostics.TraceEventType.Information);

            //populate serverlist
            LogHelper.Log("Login Form Server List Population", System.Diagnostics.TraceEventType.Start);
            foreach (GlobalVariables.Server s in GlobalVariables.serverList)
            {
                comServers.Items.Add(s.address);
            }
            LogHelper.Log("Login Form Server List Population",System.Diagnostics.TraceEventType.Stop);
        }


        private void TestServer(string address)
        {

        }

        private void CheckUsername(string username)
        {

        }

        private void AttemptConnection(string address, string username)
        {

        }

        private void Login_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                Application.Exit();
            }
        }
    }
}
